package org.zanpu.metadataserver.core.bpm.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zanpu.metadataserver.core.aop.ServiceDataSource;
import org.zanpu.metadataserver.core.bpm.dao.BpmDao;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by MD on 2016/10/26.
 */
@Service
public class BpmService {
    @Resource
    private BpmDao bpmDao;

    @ServiceDataSource("bpm")
    public List<Map<String, Object>> query(String sql) {
        return bpmDao.query(sql);
    }

    @ServiceDataSource("bpm")
    public List<String> queryTable() {
        return bpmDao.queryTable();
    }

    @ServiceDataSource("bpm")
    public List<Map<String, Object>> queryColumns(String table) {
        return bpmDao.queryColumns(table);
    }

    @Transactional
    @ServiceDataSource("bpm")
    public int update(String sql) {
        return bpmDao.update(sql);
    }
}
